//
//  LzwbaseCollectView.m
//  NewHalfsugar
//
//  Created by 刘志武 on 16/1/9.
//  Copyright © 2016年 刘志武. All rights reserved.
//

#import "LzwbaseCollectView.h"

@implementation LzwbaseCollectView

- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout{
    
    self = [super initWithFrame:frame collectionViewLayout:layout];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeColor:) name:@"changeColor" object:nil];
        
        NSString *states = [[NSUserDefaults standardUserDefaults] objectForKey:@"night"];
        
        if ([states isEqualToString:@"yes"]) {
            //黑夜状态
            self.backgroundColor = [UIColor blackColor];
        }
        
    }

    return self;
}

- (void)changeColor:(NSNotification *)tification{
    
    UIColor *color = [tification object];
    
    self.backgroundColor = color;
    
}


@end
